import * as echarts  from "echarts";
export const condoleOptions = () => {
  return {
    title: {
      top: 15,
      left: 10,
      textStyle: {
        fontSize: 16,
        color: "#fff",
      },
      text: "历年职工慰问变化趋势",
    },
    tooltip: [
      {
        trigger: "axis",
        axisPointer: {
          type: "cross",
        },
      },
    ],
    legend: [
      {
        right: 10,
        top: 15,
        textStyle: {
          fontSize: 13,
          color: "#2F89CF",
        },
        data: [
          {
            name: "慰问人数",
          },
        ],
      },
      {
        right: 110,
        top: 15,
        textStyle: {
          fontSize: 13,
          color: "#2F89CF",
        },
        data: [
          {
            name: "慰问金额",
          },
        ],
      },
    ],
    grid: {
      top: "25%",
      left: "3%",
      right: "4%",
      bottom: "3%",
      containLabel: true,
    },
    xAxis: [
      {
        type: "category",
        boundaryGap: false,
        minorSplitLine: {
          show: true,
          lineStyle: {
            // 使用深浅的间隔色
            color: "#000",
          },
        },
        axisTick: {
          alignWithLabel: true,
        },
        data: [
          "2014",
          "2015",
          "2016",
          "2017",
          "2018",
          "2019",
          "2020",
          "2021",
          "2022",
          "2023",
        ],
      },
    ],
    yAxis: [
      {
        type: "value",
        name: "人数",
        axisLabel: {
          formatter: "{value} 人",
        },
        splitLine: {
          lineStyle: {
            color: "#012F4A",
          },
        },
      },
      {
        type: "value",
        name: "金额",
        axisLabel: {
          formatter: "{value} 元",
        },
        splitLine: {
          lineStyle: {
            color: "#012F4A",
          },
        },
      },
    ],

    series: [
      {
        name: "慰问人数",
        type: "line",
        data: [20, 25, 30, 35, 39, 45, 43, 44, 45, 50],
        smooth: true,

        areaStyle: {
          normal: {
            //线性渐变，前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’，则该四个值是绝对像素位置。
            color: new echarts.graphic.LinearGradient(
              0,
              0,
              0,
              1,
              [
                {
                  offset: 0,
                  color: "rgba(25,163,223,.3)",
                },
                {
                  offset: 1,
                  color: "rgba(25,163,223, 0)",
                },
              ],
              false
            ),
            shadowColor: "rgba(25,163,223, 0.5)", //阴影颜色
            shadowBlur: 20, //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
          },
        },
        tooltip: {
          valueFormatter: function (value: string | number) {
            return value + " 人";
          },
        },
      },
      {
        name: "慰问金额",
        type: "line",
        data: [1000, 3000, 2000, 4000, 4000, 1000, 2000, 3000, 6000, 9000],
        smooth: true,
        areaStyle: {
          normal: {
            //线性渐变，前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’，则该四个值是绝对像素位置。
            color: new echarts.graphic.LinearGradient(
              0,
              0,
              0,
              1,
              [
                {
                  offset: 0,
                  color: "rgba(159,224,128,.3)",
                },
                {
                  offset: 1,
                  color: "rgba(159,224,128,.1)",
                },
              ],
              false
            ),
            shadowColor: "rgba(159,224,128,.3)", //阴影颜色
            shadowBlur: 20, //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
          },
        },

        tooltip: {
          valueFormatter: function (value: string | number) {
            return value + " 元";
          },
        },
        yAxisIndex: 1,
      },
    ],
  };
};
